package com.engineering.elink.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.engineering.elink.co.BaseCo;
import com.engineering.elink.common.Pagination;
import com.engineering.elink.domain.ThirdCategory;
import com.engineering.elink.domain.VideoTopCategory;
import com.engineering.elink.service.VideoCategoryService;
import com.engineering.elink.skilldao.SkillMapper;
import com.engineering.elink.videodao.ThirdCategoryMapper;
import com.engineering.elink.videodao.VideoSecondaryCategoryMapper;
import com.engineering.elink.videodao.VideoTopCategoryMapper;

@Service("videoCategoryService")
public class VideoCategoryServiceImpl implements VideoCategoryService{

	@Autowired
	private VideoTopCategoryMapper videoTopCategoryMapper; 
	
	@Autowired
	private VideoSecondaryCategoryMapper videoSecondaryCategoryMapper;
	
	@Autowired
	private ThirdCategoryMapper thirdCategoryMapper;
	
	@Autowired
	private SkillMapper skillMapper;
	

	@Override
	public List<VideoTopCategory> getTopCategory(Integer tcId) {
		return videoTopCategoryMapper.selectList(tcId);
	}


	@Override
	public Map<String,Object> getSecondaryCategory(int tcId,BaseCo co) {
		
		Map<String, Object> map = new HashMap<String, Object>();
		
		map.put("list", videoSecondaryCategoryMapper.selectListByTcId(tcId,co));
		map.put("Pagination", new Pagination(co, videoSecondaryCategoryMapper.countListByTcId(tcId)));
		
		return map;
		
	}
	@Override
	public List<ThirdCategory> getThirdCategory(int scId) {
		return thirdCategoryMapper.selectListByScId(scId);
	}

	@Override
	public List<VideoTopCategory> getSkillTopCategory() {
		return skillMapper.selectSkillTopList(null);
	}

}
